//首页面
import 'package:flutter/material.dart';
import 'package:test_xzkdemo/utils/common/global.dart';
import 'package:test_xzkdemo/utils/weights/decoration.dart';

//列表页面示例
class HomeMainPage extends StatefulWidget {
  HomeMainPage({Key key, String title}) : super(key: key);

  final String title = "我的";

  @override
  _HomeMainPageState createState() => new _HomeMainPageState();
}

class _HomeMainPageState extends State<HomeMainPage> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: Column(
        children: <Widget>[
          //列表页面
          buildHeader(context),
          buildBody(context),
        ],
      ),
    );
  }

  //页面三部分：顶部组件
  Widget buildHeader(BuildContext context) {
    //点击进入地址字母页面
    return Container(
      margin: EdgeInsets.only(left: 12, top: 30, right: 12, bottom: 10),
      width: G.screenWidth(context),
      decoration: DecorationUtil.buildBoxGrayBorder(),
      child: FlatButton(
          onPressed: () => Navigator.of(context).pushNamed('/sortCity'),
          child: Text(
            "进入地址选择页面",
            style: TextStyle(
              color: Colors.grey,
              fontSize: 12,
            ),
          )),
    );
  }
 
  //页面三部分：body组件
  Widget buildBody(BuildContext context) { 
    return FlatButton(
          onPressed: () => Navigator.of(context).pushNamed('/xinshiMap2'),
          child: Text(
            "进入地图",
            style: TextStyle(
              color: Colors.grey,
              fontSize: 12,
            ),
          )
        );
          
  }
  //页面三部分：footer组件
  Widget buildFooter(BuildContext context) {return null;}
}
